<?php
include "../../Koneksi/koneksi.php";


$mapel = $_POST['mapel'];
$pendidik = $_POST['pendidik'];
$kode = $mapel."_".$pendidik;

$cek = mysql_fetch_array(mysql_query("SELECT kodeGuruMapel FROM guruMapel WHERE kodeGuruMapel='$kode'"));
if (empty($cek['kodeGuruMapel'])) {
    mysql_query("insert into guruMapel (kodeGuruMapel, mataPelajaran, pendidik) value "
            . "('$kode' ,'$mapel' ,'$pendidik' "
            . ")");
    $result = header('location:../Form/FormGuruMapel.php');
} else {
    ?>
    <script>alert("Kode Mapel Sudah Ada");
                    document.location.href = "../Form/FormGuruMapel.php"</script>
    <?php
}

echo $result;
?>